package com.yzc.role;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequiredArgsConstructor
@RequestMapping("/role")
public class RoleController {

    final RoleService roleService;

    /**
     * 获取用户数据
     * @return
     */
    @RequestMapping ("/loadAll.do")
    public List loadAll(){
        return roleService.loadaAll();
    }

    /**
     * 修改用户数据
     * @return
     */
    @RequestMapping("/update.do")
    public Map updateInfo(RoleBean roleBean){
        return roleService.updateInfo(roleBean);
    }

    /**
     * 更新用户数据
     * @return
     */
    @RequestMapping("/save.do")
    public Map save(RoleBean roleBean){
        return roleService.save(roleBean);
    }

    /**
     * 删除用户数据
     * @return
     */
    @RequestMapping("/delete.do")
    public Map deleteInfo(RoleBean roleBean){
        return roleService.deleteInfo(roleBean);
    }

    /**
     * 查询用户数据
     * @return
     */
    @RequestMapping("/selectInfo.do")
    public List selectInfos(RoleBean roleBean){
        return roleService.selectInfos(roleBean);
    }

    /**
     * 根据id查询
     * @return
     */
    @RequestMapping("/getInfoById.do")
    public Map getInfoById(RoleBean roleBean){
        return roleService.getInfoById(roleBean);
    }


    @RequestMapping("/saveMenus.do")
    public Map saveMenus(@RequestBody  RoleBean roleBean) {
        return roleService.saveMenu(roleBean);
    }
    @RequestMapping("/loadRoleList.do")
    public List loadRoleList() {
        return roleService.loadRoleList();
    }
}
